/*
 * @Author: Clark
 * @Email: haixuanwoTxh@gmail.com
 * @Date: 2023-01-05 11:59:17
 * @LastEditors: Clark
 * @LastEditTime: 2023-01-05 14:38:19
 * @Description: file content
 */

#include "apue.h"
#include <sys/wait.h>

int main()
{
    pid_t pid;

    if ((pid = fork()) < 0)
    {
        err_sys("fork error");
    }
    else if (0 == pid)
    {
        if (execl("/usr/bin/ls", "ls", "-l", "-t", (char*)0) < 0)
        {
            err_sys("execl error");
        }
    }

    if (waitpid(pid, NULL, 0) < 0)
    {
        err_sys("waitpid error");
    }

    exit(0);
}
